<?php
/**
 * Created by PhpStorm.
 * User: yuanjie
 * Date: 15/12/21
 * Time: 下午3:44
 */
use Overtrue\Wechat\Auth;
class WeChatAuthController extends BaseController
{
    public function get_auth(){
        $auth = new Auth(Config::get('wechat.APP_ID'), Config::get('wechat.APP_SECRET'));

        //生成菜单URL
//        $url = $auth->url('http://api.yangche1hao.com/wechat/auth', 'snsapi_base');
//        var_dump($url);
//        exit;

        try {
            $user = $auth->authorize();
        } catch (Exception $e) {
            echo '获取失败：' . $e->getMessage();
        }
        return View::make("activity.checkin")->with('user',$user);
    }
}